package com.jusyl.cristo.spider.yl;

import java.util.List;

import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.model.ConsolePageModelPipeline;
import us.codecraft.webmagic.model.OOSpider;
import us.codecraft.webmagic.model.annotation.ExtractBy;
import us.codecraft.webmagic.model.annotation.HelpUrl;
import us.codecraft.webmagic.model.annotation.TargetUrl;

@TargetUrl("http://4v3v.com/htm/novel2/*")
@HelpUrl("http://4v3v.com/htm/Article2/")
public class LiuBeiModel {
	@ExtractBy("//div[@class='page_title']/h3/text()")
	private String title;
	
	@ExtractBy("//div[@class='content']/p/text()")
	private List<String> paragraphs;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public List<String> getParagraphs() {
		return paragraphs;
	}

	public void setParagraphs(List<String> paragraphs) {
		this.paragraphs = paragraphs;
	}

	public static void main(String arg[]) {
		OOSpider.create(Site.me().setSleepTime(1000), 
						new ConsolePageModelPipeline(), 
						LiuBeiModel.class).addUrl("http://4v3v.com/htm/novel2/103.htm").thread(1).run();
		
	}
}
